package com.z.pojo;

import java.io.Serializable;
import java.util.List;

/**
 * @author 张福兴
 * date 2021/9/1
 */


public class PageBean<T> implements Serializable {
    /**
     * 当前页面
     */
    private Integer     nowpage;
    /**
     * 每页多少条数据
     */
    private Integer     eachcount;
    /**
     * 数据总页数
     */
    private Integer     totalpage;
    /**
     * 数据库数据的数量总数
     */
    private Integer     totalcount;
    /**
     * 分页查询到的list集合
     */
    private List<T>     lists;
    /**
     * 跳转的url
     */
    private String     url;

    public PageBean() {
    }

    public PageBean(Integer nowpage, Integer eachcount, Integer totalpage, Integer totalcount, List<T> lists, String url) {
        this.nowpage = nowpage;
        this.eachcount = eachcount;
        this.totalpage = totalpage;
        this.totalcount = totalcount;
        this.lists = lists;
        this.url = url;
    }

    public Integer getNowpage() {
        return nowpage;
    }

    public void setNowpage(Integer nowpage) {
        this.nowpage = nowpage;
    }

    public Integer getEachcount() {
        return eachcount;
    }

    public void setEachcount(Integer eachcount) {
        this.eachcount = eachcount;
    }

    public Integer getTotalpage() {
        return this.totalcount%this.eachcount==0?totalcount/eachcount:totalcount/eachcount+1;
    }

    public void setTotalpage(Integer totalpage) {
        this.totalpage = totalpage;
    }

    public Integer getTotalcount() {
        return totalcount;
    }

    public void setTotalcount(Integer totalcount) {
        this.totalcount = totalcount;
    }

    public List<T> getLists() {
        return lists;
    }

    public void setLists(List<T> lists) {
        this.lists = lists;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        return "PageBean{" +
                "nowpage=" + nowpage +
                ", eachpage=" + eachcount +
                ", totalpage=" + totalpage +
                ", totalcount=" + totalcount +
                ", lists=" + lists +
                ", url='" + url + '\'' +
                '}';
    }
}
